package function;

import model.Author;
import model.GetAuthors;

import java.util.List;

public class Count {
    public static void main(String[] args) {
        List<Author> authors = GetAuthors.getAuthors();
        long count = authors.stream()
                .flatMap(author -> author.getBooks().stream())//转化为book流
                .distinct()//对book流去重
                .count();//总书本数
        System.out.println("作家写的书总数: "+count);
    }
}
